package com.cssy.yd.logic.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.cssy.yd.logic.dao.LogicPoWareDAO;
import com.cssy.yd.logic.entity.LogicPoWareDO;
import com.plat.helper.SearchConditions;

/**
 * ��ݷ��ʶ���ʵ����
 * @since 2013-07-24
 */
public class LogicPoWareDAOImpl extends SqlMapClientDaoSupport implements LogicPoWareDAO {

    /**
     * �������
     * @param logicPoWareDO
     * @return ������ݵ�����
     */
    public String insertLogicPoWareDO(LogicPoWareDO logicPoWareDO) throws DataAccessException {
        Object id = getSqlMapClientTemplate().insert("LogicPoWare.insert", logicPoWareDO);
        return (String) id;
    }

    /**
     * ͳ�Ƽ�¼��
     * @param logicPoWareDO
     * @return ����ļ�¼��
     */
    public Integer countLogicPoWareDOByExample(LogicPoWareDO logicPoWareDO) throws DataAccessException {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicPoWare.countByDOExample", logicPoWareDO);
        return count;
    }

    /**
     * ���¼�¼
     * @param logicPoWareDO
     * @return ��Ӱ�������
     */
    public Integer updateLogicPoWareDO(LogicPoWareDO logicPoWareDO) throws DataAccessException {
        int result = getSqlMapClientTemplate().update("LogicPoWare.update", logicPoWareDO);
        return result;
    }

    /**
     * ��ȡ�����б�
     * @param logicPoWareDO
     * @return �����б�
     */
    @SuppressWarnings("unchecked")
    public List<LogicPoWareDO> findListByExample(LogicPoWareDO logicPoWareDO) throws DataAccessException {
        List<LogicPoWareDO> list = getSqlMapClientTemplate().queryForList("LogicPoWare.findListByDO", logicPoWareDO);
        return list;
    }

    /**
     * ��������ȡlogicPoWareDO
     * @param id
     * @return logicPoWareDO
     */
    public LogicPoWareDO findLogicPoWareDOByPrimaryKey(String id) throws DataAccessException {
        LogicPoWareDO logicPoWareDO = (LogicPoWareDO) getSqlMapClientTemplate().queryForObject("LogicPoWare.findByPrimaryKey", id);
        return logicPoWareDO;
    }

    /**
     * ɾ���¼
     * @param id
     * @return ��Ӱ�������
     */
    public Integer deleteLogicPoWareDOByPrimaryKey(String id) throws DataAccessException {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicPoWare.deleteByPrimaryKey", id);
        return rows;
    }
    
    @Override
    public List<LogicPoWareDO> find(SearchConditions scs) throws DataAccessException{
		List<LogicPoWareDO> list = getSqlMapClientTemplate().queryForList("LogicPoWare_ex.find", scs);
   		   return list;
    }
    
	@Override
    public Integer count(SearchConditions scs) throws DataAccessException {		
		 Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicPoWare_ex.count", scs);
  	      return count;
  	}
	@Override
	public Integer untreatedPowarecode(Map<String, Object> map)
			throws DataAccessException {
		 Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicPoWare_ex.untreatedPowarecode", map);
 	     return count;
	}

	@Override
	public List<LogicPoWareDO> findAuthorityStatus(SearchConditions scs)
			throws DataAccessException {
		List<LogicPoWareDO> list = getSqlMapClientTemplate().queryForList("LogicPoWare_ex.findAuthorityStatus", scs);
		   return list;
	}

	@Override
	public Integer findAuthorityStatusCount(SearchConditions scs)
			throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicPoWare_ex.findAuthorityStatusCount", scs);
	      return count;
	}
}